// index.js
Page({
  data: {
    // 轮播图数据
    banners: [
      '/images/banner1.svg',
      '/images/banner2.svg'
    ],
    // 服务分类数据
    services: [
      { id: 1, name: '全身按摩', icon: '/images/service1.svg' },
      { id: 2, name: '足底按摩', icon: '/images/service2.svg' },
      { id: 3, name: '推拿理疗', icon: '/images/service3.svg' },
      { id: 4, name: '精油SPA', icon: '/images/service4.svg' }
    ],
    // 团购数据
    groupbuys: [
      {
        id: 1,
        title: '【3人团】全身按摩套餐',
        image: '/images/group1.svg',
        price: 168,
        originalPrice: 238,
        progress: 68
      }
    ],
    packages: [
      {
        id: 1,
        image: '/images/service1.jpg',
        title: '全身按摩舒缓套餐',
        desc: '60分钟全身推拿+肩颈理疗',
        price: 168,
        originalPrice: 238
      },
      {
        id: 2,
        image: '/images/service2.jpg',
        title: '足疗养生套餐',
        desc: '40分钟足底按摩+精油热敷',
        price: 128,
        originalPrice: 188
      }
    ]
  },

  onLoad: function(options) {
    // 页面加载时初始化数据
    console.log('首页加载完成');
  },

  // 跳转到服务详情页
  gotoService: function(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/service/service?id=${id}`
    });
  },

  // 跳转到团购页面
  gotoGroupbuy: function() {
    wx.navigateTo({
      url: '/pages/groupbuy/groupbuy'
    });
  },

  // 跳转到会员中心
  gotoMember: function() {
    wx.navigateTo({
      url: '/pages/member/member'
    });
  },

  // 跳转到邀请好友页面
  gotoReferral: function() {
    wx.navigateTo({
      url: '/pages/referral/referral'
    });
  },

  // 跳转到我的收益页面
  gotoEarnings: function() {
    wx.navigateTo({
      url: '/pages/earnings/earnings'
    });
  },

  // 跳转到我的订单页面
  gotoOrder: function() {
    wx.navigateTo({
      url: '/pages/order/order'
    });
  }
})